package cn.ekuma.epos.module;

import java.util.List;

import cn.ekuma.rabbit.ModelManager;
import cn.ekuma.rabbit.imp.AbstractModel;
import cn.ekuma.rabbit.spi.I_Model;
import cn.ekuma.security.I_SecurityManager;

import com.openbravo.data.basic.BasicException;
import com.openbravo.pos.base.AppView;
import com.openbravo.pos.base.BeanFactoryException;
import com.openbravo.pos.base.BeanFactoryManager;

public class CoreModel extends AbstractModel{
	
	public static String NAME="cn.ekuma.epos.module.CoreModel";
	private BeanFactoryManager beanFactoryManager;
	
	AppView app;

	public CoreModel(BeanFactoryManager beanFactoryManager, AppView app) {
		super();
		this.beanFactoryManager = beanFactoryManager;
		this.app = app;
	}

	public CoreModel(AppView app) {
		super();
		this.app = app;
	}
	
	@Override
	public String getModelName() {
		return NAME;
	}

	@Override
	public String getModelDescription() {
		return "the core model";
	}


	@Override
	public Object getBean(String beanfactory) throws BeanFactoryException {
		if(beanFactoryManager==null)
			beanFactoryManager=new BeanFactoryManager(app,manager);
		return beanFactoryManager.getBean(beanfactory);
	}

	@Override
	public String getVersion() {
		return "1.0";
	}

	public AppView getApp() {
		return app;
	}

	

}
